
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
<head>
<title>包邮活动列表管理</title>
<script type="text/javascript">

</script>
</head>
<body>
	<div layout:fragment="content">

		<div class="row">
			<div class="table-toolbar col-md-12">
				<div class="table-toolbar col-md-12">
					<div class="btn-group pull-right"><a href="edit.html" th:href="@{/promotion/postforfreeactivity/add}" id="Link_add" class="btn green">添加包邮活动<i class="fa fa-plus"></i></a></div>
				</div>
				<div class="col-md-15 col-sm-13">
			
					<form id="form_submit" class="form-inline" th:action="@{/promotion/postforfreeactivity/index}" th:object="${postForFreeActivitySearch}"  method="post">
						<div class="form-group">
						    <label class="sr-only" for="postForFreeName">包邮名称</label>
							<input type="text" name="postForFreeName" th:field="*{postForFreeName}" style="width:120px;" placeholder="包邮名称"   id="postForFreeName" class="form-control" />
						</div> 
						
						<div class="form-group" >
							<div class="col-md-4">
								<input id="startTime" name="startTime" style="width:180px;" th:field="*{startTime}" data-format="yyyy-MM-dd hh:mm:ss" placeholder="开始时间" class="form-control" type="text"></input>
							</div>
						</div>
						<div class="form-group"> 
							<div class="col-md-4">
								<input id="endTime" name="endTime" style="width:180px;" th:field="*{endTime}" data-format="yyyy-MM-dd hh:mm:ss" placeholder="结束时间" class="form-control" type="text"></input>
							</div>
						</div>	
						<div class="form-group"> 
							<div class="col-md-4">
								<select id="activitiesState" name="activitiesState" th:field="*{activitiesState}" class="form-control">
									<option value="0">全部</option>
									<option value="1">正在进行中</option>
									<option value="2">即将开始</option>
									<option value="3">已过期</option>
								</select>
							</div>
						</div>					
						
						<button type="submit" id="bt_search" name="bt_search" class="btn green" onclick="checkDate();">
							<i class="fa  fa-search"></i>
						</button>
					</form>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-md-12">
				<div id="div_activity_list" th:include="promotion/postforfreeactivity/activity_table">
                   
				</div>
			</div>
		</div>
	</div>
</body>
</html>

 <script th:inline="javascript">
	/*<![CDATA[*/
		$("#startTime").click(function(){
			WdatePicker({startDate:'%y-%M-01',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
		}).focus(function () {
            WdatePicker({startDate:'%y-%M-01 ',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
        });
	
		$("#endTime").click(function(){
			WdatePicker({startDate:'%y-%M-01',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
		}).focus(function () {
            WdatePicker({startDate:'%y-%M-01 ',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
        });	
			
		  
		  
		  function checkDate(){
			  var startTime=$("#startTime").val();
			  var endTime=$("#endTime").val(); 
			  var start=new Date(startTime.replace("-", "/").replace("-", "/"));     
			  var end=new Date(endTime.replace("-", "/").replace("-", "/"));  
			  
			  if(end<start){  
			        alert("开始时间要小于结束时间"); 
			        $("#startTime").val("");
			        $("#endTime").val("");
			        return false;
			   } 			 
		  }
	       
	           
	/*]]>*/
</script>
